import Vue from 'vue';
import Router from 'vue-router';
// index
const index = () => import('../components/index/index.vue');
const searchContent = () => import('../components/index/components/searchContent');
// public
const postContent = () => import('../components/public/postContent');
// personal
const personal = () => import('../components/personal/personalCenter');
const classItem = () => import('../components/personal/components/classItem');
const myFollowPost = () => import('../components/personal/components/myFollowPost');
const relatedUser = () => import('../components/personal/components/relatedUser');
const integralDetail = () => import('../components/personal/components/integralDetail');
const changePass = () => import('../components/personal/components/changePass');
const chaPerData = () => import('../components/personal/components/chaPerData');

Vue.use(Router);

export default new Router({
/*  mode : 'history',*/
  routes : [
    // 默认
    {
      path:'/',
      redirect : '/index'
    },
    // index
    {
      path : '/index',
      name : 'index',
      components : {
        main : index
      },
      // 主页上展示帖子列表
      redirect : '/index/postContent',
      children: [
        {
          path: '/index/postContent',
          name : 'postContent',
          components : {
            content : postContent
          }
        },
        {
          path: '/index/searchContent/:classify',
          name : 'searchContent',
          components : {
            content : searchContent
          }
        },
      ]
    },
    // personal
    {
      path : '/personal',
      name : 'personal',
      components : {
        main : personal
      },
      children : [
        {
          path : '/',
          redirect : '/personal/myDynamic'
        },
        {
          path : '/personal/myDynamic',
          name : 'myDynamic',
          components : {
            content : postContent
          }
        },
        {
          path : '/personal/classItem',
          name : 'classItem',
          components : {
            content : classItem
          }
        },
        {
          path : '/personal/myFollowPost',
          name : 'myFollowPost',
          components : {
            content : myFollowPost
          }
        },
        {
          path : '/personal/relatedUser',
          name : 'relatedUser',
          components : {
            content : relatedUser
          }
        },
        {
          path : '/personal/integralDetail',
          name : 'integralDetail',
          components : {
            content : integralDetail
          }
        },
        {
          path : '/personal/changePass',
          name : 'changePass',
          components : {
            user : changePass
          }
        },
        {
          path : '/personal/chaPerData',
          name : 'chaPerData',
          components : {
            user : chaPerData
          }
        }
      ]
    }
  ]
})
